package top.fangw.common.core.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonInclude;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.time.LocalDateTime;

/**
 * @description: 只包含创建信息的实体类
 * @author: fgw
 * @createDate: 2024/1/16
 */
@Getter
@Setter
@Accessors(chain = true)
public class CreateEntityWithOutId implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;


    @Schema(description = "创建人id")
    @TableField(value = "created_by",fill = FieldFill.INSERT)
    private String createdBy;

    @Schema(description = "创建人姓名")
    @TableField(value = "created_by_name", fill = FieldFill.INSERT)
    private String createdByName;

    @Schema(description = "创建时间")
    @TableField(value = "created_at",fill = FieldFill.INSERT)
    @JsonInclude(value = JsonInclude.Include.NON_NULL)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createdAt;

    @Schema(description = "删除标记，0否1是")
    @TableField("del_flag")
    @TableLogic(value = "0",delval = "1")
    private String delFlag;

    @Schema(description = "备注")
    @TableField("remark")
    private String remark;
}
